package org.sdfc.model

import com.documentum.fc.common.IDfId
import com.documentum.fc.common.IDfTime

import org.sdfc.model.attr._

trait TypedObject {
  
  //attributes reading methods mimicking IDfTypedObject
  
  /** Reads the value of a SingleBooleanAttribute. */
  def getBoolean(attr : SingleBooleanAttribute) : Boolean
  
  /** Reads the value of a SingleIntAttribute. */
  def getInt(attr : SingleIntAttribute) : Int
  
  /** Reads the value of a SingleStringAttribute. */
  def getString(attr : SingleStringAttribute) : String
  
  /** Reads the value of a SingleIdAttribute. */
  def getId(attr : SingleIdAttribute) : IDfId
  
  /** Reads the value of a SingleTimeAttribute. */
  def getTime(attr : SingleTimeAttribute) : IDfTime
  
  /** Reads the value of a SingleDoubleAttribute. */
  def getDouble(attr : SingleDoubleAttribute) : Double
  
  
  /** Counts the values of a RepeatingAttribute. */
  def getValueCount(attr : RepeatingAttribute[_]) : Int
  
  /** Reads the value of a RepeatingBooleanAttribute at a given index. */
  def getRepeatingBoolean(attr : RepeatingBooleanAttribute, index : Int) : Boolean
  
  /** Reads the value of a RepeatingIntAttribute at a given index. */
  def getRepeatingInt(attr : RepeatingIntAttribute, index : Int) : Int
  
  /** Reads the value of a RepeatingStringAttribute at a given index. */
  def getRepeatingString(attr : RepeatingStringAttribute, index : Int) : String
  
  /** Reads the value of a RepeatingIdAttribute at a given index. */
  def getRepeatingId(attr : RepeatingIdAttribute, index : Int) : IDfId
  
  /** Reads the value of a RepeatingTimeAttribute at a given index. */
  def getRepeatingTime(attr : RepeatingTimeAttribute, index : Int) : IDfTime
  
  /** Reads the value of a RepeatingDoubleAttribute at a given index. */
  def getRepeatingDouble(attr : RepeatingDoubleAttribute, index : Int) : Double
  
  
  /** Searchs the values of a RepeatingBooleanAttribute for a given one and returns its index, -1 for not found. */
  def findBoolean(attr : RepeatingBooleanAttribute, value : Boolean) : Int
  
  /** Searchs the values of a RepeatingIntAttribute for a given one and returns its index, -1 for not found. */
  def findInt(attr : RepeatingIntAttribute, value : Int) : Int
  
  /** Searchs the values of a RepeatingStringAttribute for a given one and returns its index, -1 for not found. */
  def findString(attr : RepeatingStringAttribute, value : String) : Int
  
  /** Searchs the values of a RepeatingIdAttribute for a given one and returns its index, -1 for not found. */
  def findId(attr : RepeatingIdAttribute, value : IDfId) : Int
  
  /** Searchs the values of a RepeatingTimeAttribute for a given one and returns its index, -1 for not found. */
  def findTime(attr : RepeatingTimeAttribute, value : IDfTime) : Int
  
  /** Searchs the values of a RepeatingDoubleAttribute for a given one and returns its index, -1 for not found. */
  def findDouble(attr : RepeatingDoubleAttribute, value : Double) : Int
  
  
  //convenient additional attributes reading methods
  
  /** Iterates over the values of a RepeatingBooleanAttribute. */
  def getValues(attr : RepeatingBooleanAttribute) : Iterator[Boolean]
  
  /** Iterates over the values of a RepeatingIntAttribute. */
  def getValues(attr : RepeatingIntAttribute) : Iterator[Int]
  
  /** Iterates over the values of a RepeatingStringAttribute. */
  def getValues(attr : RepeatingStringAttribute) : Iterator[String]
  
  /** Iterates over the values of a RepeatingIdAttribute. */
  def getValues(attr : RepeatingIdAttribute) : Iterator[IDfId]
  
  /** Iterates over the values of a RepeatingTimeAttribute. */
  def getValues(attr : RepeatingTimeAttribute) : Iterator[IDfTime]
  
  /** Iterates over the values of a RepeatingDoubleAttribute. */
  def getValues(attr : RepeatingDoubleAttribute) : Iterator[Double]
  
}
